package info.pixstone.foodhunter.Servelet;
import info.pixstone.foodhunter.acquaintance.IAAdWord;
import info.pixstone.foodhunter.acquaintance.IAConstants;
import info.pixstone.foodhunter.acquaintance.IADishes;
import info.pixstone.foodhunter.acquaintance.IAInvitation;
import info.pixstone.foodhunter.acquaintance.IALocation;
import info.pixstone.foodhunter.acquaintance.IAPhoto;
import info.pixstone.foodhunter.acquaintance.IARestaurant;
import info.pixstone.foodhunter.acquaintance.IAUser;
import info.pixstone.foodhunter.acquaintance.IAWeibo;
import info.pixstone.foodhunter.domain.mediator.DaoFactory;

import java.io.IOException;
import javax.servlet.http.*;

@SuppressWarnings("serial")

public class TestServlet extends HttpServlet
{
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		DaoFactory appFactory=DaoFactory.getInstance(IAConstants.FACTORY_NAME);
		IARestaurant res=	appFactory.createRestaurant();
		res.setRID(100);
		res.setResTel("13609504162");
		IALocation loc=appFactory.createrLocation();
		loc.setLong(119.23);
		loc.setLat(26.32);
		res.setLocation(loc);
		System.out.println(res.getRID());
		System.out.println(res.getResTel());
		resp.setContentType("text/plain");
		resp.getWriter().println(res.getRID());
		resp.getWriter().println(res.getResTel());
		resp.getWriter().println(res.getLocation().getLong());
		resp.getWriter().println(res.getLocation().getLat());
		
		IAPhoto photo=appFactory.createPhoto();
		photo.setPMeta("size:300*400\nFormat:jpeg");
		resp.getWriter().println(photo.getPMeta());
		
		IADishes dishes=appFactory.createDish();
		dishes.setDishName("sea food");
		resp.getWriter().println("EDish:"+dishes.getDishName());
		
		IAUser user=appFactory.createUser();
		user.setNickName("sand glass");
		resp.getWriter().println("EUser:"+user.getNickName());
		
		IAAdWord ad=appFactory.createAdWord();
		ad.setCoutent("70% discount");
		resp.getWriter().println("EAdWord:"+ad.getCoutent());
		
		IAInvitation invitation=appFactory.createInvitation();
		invitation.setContent("let's have dinner together");
		resp.getWriter().println("EInvitation:"+invitation.getContent());
		
		IAWeibo weibo=appFactory.createWeibo();
		weibo.setContent("weather today is good");
		resp.getWriter().println("EWeibo:"+weibo.getContent());
		
	}

}
